#include "cmd.h"
#include "mystrcmp.h"

#define MAX  4
cmd_t cmd_arr[MAX] = {
	[0] = {
		.cmdStr = "redon",
		.stat = 1,
		.gpio = GPIOA,
		.pin = GPIO_PIN_28,
		.level = HIGH_LEVEL,
		.led_p = hal_gpio_write,
	},
	[1] = {
		.cmdStr = "redoff",
		.stat = 1,
		.gpio = GPIOA,
		.pin = GPIO_PIN_28,
		.level = LOW_LEVEL,
		.led_p = hal_gpio_write,		
	},
	
	[2] = {
		.cmdStr = "beepon",
		.stat = 2,
		.beep_p = hal_pwm_on,
	},
	[3] = {
		.cmdStr = "beepoff",
		.stat = 2,
		.beep_p = hal_pwm_off,
	},
	
};


cmd_t *find_cmd(char *uart_cmd_str)
{
	int i ;
	for (i = 0 ; i < MAX; i++) {
		if (!mystrcmp(uart_cmd_str, cmd_arr[i].cmdStr))
		{
			return &cmd_arr[i];
		}
	}
	return 0;
}
